package com.jfeat.am.module.wegou.services.crud.service.impl;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.jfeat.am.common.crud.impl.CRUDServiceGroupImpl;
import com.jfeat.am.module.wegou.services.crud.service.TagManageService;
import com.jfeat.am.module.wegou.services.domain.dao.QueryTagManageDao;
import com.jfeat.am.module.wegou.services.persistence.dao.TagManageMapper;
import com.jfeat.am.module.wegou.services.persistence.model.TagManage;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 店铺标签表 implementation
 * </p>
 *
 * @author Code Generator
 * @since 2018-01-03
 */
@Service
public class TagManageServiceImpl extends CRUDServiceGroupImpl<TagManage> implements TagManageService {


    @Resource
    private TagManageMapper tagManageMapper;
    @Resource
    private QueryTagManageDao queryTagManageDao;

    @Override
    protected BaseMapper<TagManage> getGroupMapper() {
        return tagManageMapper;
    }

    @Override
    public List<TagManage> queryTagManage(Page<TagManage> page, String tagName, String zhTagName) {
        EntityWrapper<TagManage> entityWrapper = new EntityWrapper<>();
        if (tagName != null){
            entityWrapper.like(TagManage.TAG_NAME,tagName);
        }
        if (zhTagName != null){
            entityWrapper.like(TagManage.ZH_TAG_NAME,zhTagName);
        }
        return queryTagManageDao.selectList(page,entityWrapper);
    }
}


